//
//  YZWBAttentionView.m
//  VET
//
//  Created by Lam BG on 2018/8/2.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZWBAttentionView.h"

#import "TBCityIconFont.h"

#import "UIView+Frame.h"

@interface YZWBAttentionView ()

@property (weak, nonatomic) IBOutlet UILabel *messageLabel;

@end

@implementation YZWBAttentionView

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.layer.cornerRadius = self.height / 2;
}

- (void)changeStyle:(AttentionViewStyle)style {
    
    UIColor *bgColor = nil;
    switch (style) {
        case AttentionViewStyleWorkNormal: // 创建待办
        {
            self.messageLabel.text = @"\ue644 创建待办";
            self.messageLabel.font = [UIFont fontWithName:@"iconfont" size:17];
            self.messageLabel.textColor = kColorWithHex(0x32BE60);
//            self.backgroundColor = kColorWithHex(0xFFFFFF);
            bgColor = kColorWithHex(0xFFFFFF);
        }
            break;
            
        case AttentionViewStyleWorkTip:
        {
            self.messageLabel.text = @"处理待办 \ue646";
            self.messageLabel.font = [UIFont fontWithName:@"iconfont" size:17];
            self.messageLabel.textColor = kColorWithHex(0xFFFFFF);
//            self.backgroundColor = kColorWithHex(0xFBA84E);
            bgColor = kColorWithHex(0xFBA84E);
        }
            break;
            
        case AttentionViewStyleWorkWarnning:
        {
            self.messageLabel.text = @"马上处理 \ue646";
            self.messageLabel.font = [UIFont fontWithName:@"iconfont" size:17];
            self.messageLabel.textColor = kColorWithHex(0xFFFFFF);
//            self.backgroundColor = kColorWithHex(0xFF6356);
            bgColor = kColorWithHex(0xFF6356);
        }
            break;
            
        case AttentionViewStyleNoteNormal:
        {
            self.messageLabel.text = @"\ue645 创建笔记";
            self.messageLabel.font = [UIFont fontWithName:@"iconfont" size:17];
            self.messageLabel.textColor = kColorWithHex(0xFFFFFF);
            
            self.layer.borderWidth = 0.5f;
            self.layer.borderColor = kColorWithHex(0xFFFFFF).CGColor;
//            self.backgroundColor = kColorWithHex(0x32BE60);
            
            bgColor = kColorWithHex(0x32BE60);
        }
            break;
            
        case AttentionViewStyleNoteEdit:
        {
            self.messageLabel.text = @"管理笔记   ";
            self.messageLabel.textColor = kColorWithHex(0xFFFFFF);
            
            self.layer.borderWidth = 0.5f;
            self.layer.borderColor = kColorWithHex(0xFFFFFF).CGColor;
//            self.backgroundColor = kColorWithHex(0x32BE60);
            
            bgColor = kColorWithHex(0x32BE60);
        }
            break;
            
        default:
            break;
    }
    
    self.messageLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
    [UIView animateWithDuration:.35 animations:^{
        
        dispatch_async(dispatch_get_main_queue(), ^{
            
            self.backgroundColor = bgColor;
        });
    }];
    
}

@end
